home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / dosutils / tsbat50.zip / DOSTRICK.TXT < prev    next >
Internet Message Format  |  1996-05-26  |  12KB

  1. From ts@uwasa.fi Sun May 26 00:00:00 1996
  2. Subject: Dostricks file information
  3.  
  4. Assorted MS-DOS Tricks                               Sun 26-May-1996
  5. ======================
  6.                                                  All rights reserved
  7.                                Copyright (c) 1994-1996 by Timo Salmi
  8.  
  9. ....................................................................
  10. Prof. Timo Salmi   Co-moderator of news:comp.archives.msdos.announce
  11. Moderating at ftp:// & http://garbo.uwasa.fi archives  193.166.120.5
  12. Department of Accounting and Business Finance  ; University of Vaasa
  13. ts@uwasa.fi http://uwasa.fi/~ts BBS 961-3170972; FIN-65101,  Finland
  14. ....................................................................
  15.  
  16.   ┌───────────────────────────────────────────────────────────┐
  17.   │ This file belongs to TSBAT*.ZIP. Please do not distribute │
  18.   │ this dostrick.txt file separately! If you see this file   │
  19.   │ alone on a BBS, please alert the SysOp immediately.       │
  20.   └───────────────────────────────────────────────────────────┘
  21.  
  22. You are free to quote brief passages from this file provided you
  23. clearly indicate the source with a proper acknowledgment.
  24.  
  25. Comments and corrections are solicited. But if you wish to have
  26. individual MS-DOS usage consultation, please rather post your
  27. question to a Usenet newsgroup like news:comp.os.msdos.misc. It is
  28. much more efficient than asking me by email. I'd like to help, but I
  29. am very pressed for time. I prefer to pick the questions I answer
  30. from the Usenet news. Thus I can answer publicly at one go if I
  31. happen to have an answer. Besides, newsgroups have a number of
  32. readers who might know a better or an alternative answer. Don't be
  33. discouraged, though, if you get a reply like this from me. I am
  34. always glad to hear from fellow MS-DOS users.
  35. --------------------------------------------------------------------
  36.  
  37. From ts@uwasa.fi Sun May 26 00:00:01 1996
  38. Subject: Dostricks index
  39.  
  40. INDEX
  41. =====
  42.  
  43. 1) Disabling MS-DOS commands
  44. 2) Simulating disk partitioning
  45. 3) A config.sys and autoexec.bat example
  46. 4) Stepping through config.sys and autoexec.bat command by command
  47. 5) Getting rid of "Insert diskette for drive B:"
  48. 6) Conditional deleting of files
  49. 7) Selected Doskey macro examples
  50. --------------------------------------------------------------------
  51.  
  52. From ts@uwasa.fi Sun May 26 00:00:02 1996
  53. Subject: Disabling MS-DOS commands
  54.  
  55. 1. Disabling MS-DOS commands
  56. ============================
  57.  
  58. You may wish to disable certain MS-DOS commands for security reasons
  59. to prevent them from being used either accidentally or deliberately.
  60. If you have a command line editor, like doskey, then the disabling
  61. is rather straightforward.  All you have to do is to create a macro
  62. with the same name as the MS-DOS command. Consider the following
  63. examples. The first example disables the internal MS-DOS date
  64. command so that the date on your system cannot be changed.
  65.   doskey date=rem date has been disabled
  66. The second example disables the format command.
  67.   doskey format=rem format has been disabled
  68. Note that since format is an external command, that is it is a
  69. program on your disk, not a command in your command.com command
  70. interpreter, you can still invoke it by giving the explicit path to
  71. it like
  72.   c:\dos\format
  73. In fact, since it will be at path, a drive letter will suffice. Of
  74. course it is very easy to get rid of these redefinitions. In using
  75. doskey, you only have to press alt+F10 to clear the macros.
  76.  
  77. If you use some other command line editor than doskey then the
  78. commands are naturally slightly different.  For example were you to
  79. use CED (ftp://garbo.uwasa.fi/pc/cmdutil/ced10da.zip) the commands
  80. would be
  81.   ced syn date echo date has been disabled
  82. Restoring the date command would be
  83.   ced clear syn date
  84. --------------------------------------------------------------------
  85.  
  86. From ts@uwasa.fi Sun May 26 00:00:03 1996
  87. Subject: Simulating disk partitioning
  88.  
  89. 2. Simulating disk partitioning
  90. ===============================
  91.  
  92. Since I have more than one PC at my disposal, I have noticed that it
  93. is very useful to have some common standard on them including
  94. similar disk names. For example I always assume that R: is my
  95. ramdisk. Also I usually have my hard disk partitioned so that I have
  96. a fairly fixed usage for C: D: E: and F:. One of the PCs is an ICL
  97. laptop, with a 120Mb disk all on C: with no partitioning. below is
  98. what I have in my autoexec.bat to have the ram disk reference the
  99. way I want and to simulate the disk partitioning. Note the
  100. importance of the order of the substitute commands because of the
  101. double usage of D, since that is where the ram disk _originally_
  102. resides on my ICL configuration.
  103.   c:\dos\subst r: d:\
  104.   c:\dos\subst d: c:\d
  105.   c:\dos\subst e: c:\e
  106.   c:\dos\subst f: c:\f
  107. --------------------------------------------------------------------
  108.  
  109. From ts@uwasa.fi Sun May 26 00:00:04 1996
  110. Subject: Bootfile examples
  111.  
  112. 3. A config.sys and autoexec.bat example
  113. ========================================
  114.  
  115. There always is something to learn from looking at the other users'
  116. config.sys and autoexec.bat files. Here are mine from my office 486
  117. with MS-DOS 5.0.  I have added some comments for you.
  118.  
  119. DEVICE=C:\DOS\SETVER.EXE
  120. DEVICE=C:\DOS\HIMEM.SYS
  121. DOS=UMB
  122. device=c:\dos\emm386.exe /noems /i=e000-efff /x=d200-d600
  123. dos=high
  124. COUNTRY=032,,C:\DOS\COUNTRY.SYS
  125. FILES=30
  126. rem RamDrive of 7Mb, 128Kb sectorsize, 256 entries, extended memory
  127. devicehigh=c:\dos\ramdrive.sys 7000 128 256 /e
  128. rem ZANSI.SYS is from ftp://garbo.uwasa.fi/pc/screen/zansi12.zip
  129. devicehigh=c:\sys\zansi.sys
  130. rem Define a bigger environment size
  131. shell=c:\command.com /p /e:1024
  132. lastdrive=z
  133.  
  134. @ECHO OFF
  135. rem Description: My normal MsDos 5.0 boot with Scrollit
  136. rem Note below the trick to identify which of my PCs I am currently using:
  137. set pcid_=karvi
  138. rem Yellow text on black background
  139. echo <ESC>[40;33;1m
  140. PATH C:\DOS;c:\tools;e:\arczip
  141. rem DAILY.EXE is from /pc/ts/tsbat46.bat to run a mini-backup
  142. rem call c:\bat\daily c:\tools\pkzip -u d:\root\root c:\*.*
  143. PROMPT $p$g
  144. rem CHKSUM is from ftp://garbo.uwasa.fi/pc/goldies/chksum16.zip
  145. c:\tools\chksum command.com 49024 io.sys 9850 msdos.sys 5750
  146. loadhigh c:\dos\KEYB SU,,C:\DOS\KEYBOARD.SYS
  147. rem The Command line EDitor is from /pc/goldies/ced.zip
  148. loadhigh c:\tools\ced -B384,128,768,128,128 -Fced.cfg
  149. rem The TSR memory management until is from /pc/memutil/tsrcom35.zip
  150. c:\tools\mark scrollit
  151. rem The screen scrollback buffer is from /pc/screen/scrlit18.zip
  152. loadhigh c:\tools\scrollit /n=myname /k=myid 60
  153. rem The Snipper screen capture is from /pc/goldies/snippr24.zip
  154. loadhigh c:\tools\snipper
  155. rem The cut and paste utility is from /pc/pcmagvol/vol11n07.zip
  156. loadhigh c:\tools\dosclip2
  157. rem The CapsLock fix is from /pc/ts/tstsr20.zip
  158. loadhigh c:\tuki\shftcaps
  159. c:\dos\subst r: j:\
  160. mkdir r:\cmand
  161. copy c:\command.com r:\cmand
  162. c:\dos\attrib +r r:\cmand\command.com
  163. set comspec=r:\cmand\command.com
  164. set temp=r:\cmand
  165. c:\dos\mode con: rate=32 delay=1
  166. rem The clock comparison check is from /pc/ts/tsutil42.zip
  167. c:\tools\dtetimal 1994
  168. r:
  169. --------------------------------------------------------------------
  170.  
  171. From ts@uwasa.fi Sun May 26 00:00:05 1996
  172. Subject: Tracing boot files
  173.  
  174. 4. Stepping through config.sys and autoexec.bat command by command
  175. ==================================================================
  176.  
  177. MS-DOS 6.0 introduced the possibility of pausing at each line of
  178. config.sys and even selecting if the line is executed. If you press
  179. F8 when your PC is being booted and displays "Starting MS-DOS...",
  180. then "MS-DOS will prompt you to confirm each CONFIG.SYS command". If
  181. you have an earlier MS-DOS version, you can still put pauses in your
  182. config.sys by utilizing
  183.  6333 Jan 23 1993 ftp://garbo.uwasa.fi/pc/sysutil/pausedev.zip
  184.  pausedev.zip PAUSE for config.sys (with TP source) D.Murdoch
  185.  
  186. To step through autoexec.bat you can use the following trick
  187.   @echo off
  188.   set debug_=true
  189.   command1
  190.   if "%debug_%" == "true" pause
  191.   command2
  192.   if "%debug_%" == "true" pause
  193.   command3
  194.   set debug_=
  195.  
  196. If you have MS-DOS 6.0 or later you can use the CHOICE command to
  197. prompt whether you want a command to be executed. If you have an
  198. earlier MS-DOS version you can use "CHOOSE.EXE Ask questions in
  199. batch files" from the ftp://garbo.uwasa.fi/pc/ts/tsutlf15.zip (or
  200. ASK.EXE from ftp://garbo.uwasa.fi/pc/ts/tsbat48.zip). Below is an
  201. outline example
  202.   @echo off
  203.   set debug_=true
  204.  
  205.   if not "%debug_%" == "true" goto _comm1
  206.   CHOOSE /c:yn /n "Execute command1 [Y/N]? "
  207.   if not errorlevel==3 if errorlevel==2 goto _next2
  208.   :_comm1
  209.   command1
  210.  
  211.   :_next2
  212.   if not "%debug_%" == "true" goto _comm2
  213.   CHOOSE /c:yn /n "Execute command2 [Y/N]? "
  214.   if not errorlevel==3 if errorlevel==2 goto _next3
  215.   :_comm2
  216.   command2
  217.  
  218.   :_next3
  219.   (and so on)
  220.  
  221.   set debug_=
  222. --------------------------------------------------------------------
  223.  
  224. From ts@uwasa.fi Sun May 26 00:00:06 1996
  225. Subject: One floppy drive blues
  226.  
  227. 5. Getting rid of "Insert diskette for drive B:"
  228. ================================================
  229.  
  230.  Q: On my one-floppy-drive PC how can I get rid of the message
  231. "Insert diskette for drive B: and press any key when ready"?
  232.  
  233.  A: The answer is simple as can be. Put the following command into
  234. your AUTOEXEC.BAT file: "SUBST B: A:\". It makes B: point to the one
  235. floppy drive (A:) you have on your system.
  236. --------------------------------------------------------------------
  237.  
  238. From ts@uwasa.fi Sun May 26 00:00:07 1996
  239. Subject: Conditional del command
  240.  
  241. 6. Conditional deleting of files
  242. ================================
  243.  
  244.  This is an improved adaptation of the tip in the PC Computing
  245. Special Issue, 1001 tips, August 1994, pp. 106-232.
  246.  If you have MS-DOS 5+ you can utilize this simple doskey macro to
  247. move files to a trash directory. First ensure that such a directory
  248. exists and if not, mkdir it.
  249.   doskey del=if exist $1 copy $1 r:\trash$Tif not exist $1 echo
  250.   File $1 not found^G$Tif exist $1 del $1 /p
  251. where all the above is on the SAME line.
  252.  You can precede the command with loadhigh to save conventional
  253. memory. I have r: as ramdisk so the trash directory will
  254. automatically be erased when I turn off the computer, or when it
  255. chooses to crash :-).
  256. --------------------------------------------------------------------
  257.  
  258. From ts@uwasa.fi Sun May 26 00:00:08 1996
  259. Subject: Doskey macros
  260.  
  261. 7. Selected Doskey macro examples
  262. =================================
  263.  
  264. Here is a collection of my useful Doskey macros. They are reasonably
  265. simple. You'll learn by working them out in detail. Be somewhat
  266. careful in experimenting. Make test files to try then on rather than
  267. running them on your existing files.
  268.  
  269. a) To go up one directory level.
  270.  doskey up=if exist ..\nul cd ..
  271.  
  272. b) Move a file to another directory.
  273.  doskey mv=if exist $2\nul copy $1 $2$Tif exist $2\nul del $1 /p
  274.  
  275. c) Prevent accidental formats.
  276.  doskey format=echo Bugger off^G^G^G
  277.  (Tip: to format, give the full path. Usually c:\dos\format)
  278.  
  279. d) Touch a file's date/timestamp, that is make it to be now.
  280.  doskey touch=copy $1 + ,,$Tdir $1
  281.  
  282. e) Search for a file through all drives.
  283.  doskey where=for %f in (c d e f g h) do dir %f:\$1 /s /p /b
  284.  
  285. f) Show current time without changing it
  286.  doskey showtime=echo.$Btime$Techo.$Bdate
  287.  
  288. g) Perform a command, skipping a file (wildcards allowed).
  289.  doskey skip=attrib +h $1$T$2 $3 $4 $5 $6 $7 $8 $9$Tattrib -h $1
  290.